<template>
<div>
  <el-dialog
      title="导出信息填写"
      :visible.sync="dialogVisible"
      width="20%"
      :show-close="false"
      :close-on-click-modal="false">

    <el-form ref="form" :model="exportForm" label-width="80px" inline :rules="exportRules">
      <el-form-item label="文件名">
        <el-input v-model="exportForm.name"></el-input>
      </el-form-item>
      <el-form-item label="高度">
        <el-input v-model="exportForm.height"></el-input>
      </el-form-item>
      <el-form-item label="宽度">
        <el-input v-model="exportForm.width"></el-input>
      </el-form-item>
    </el-form>
    <span style="color: red">*高度建议不超过500，宽度不超过1000</span>
    <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="startExport">确 定</el-button>
  </span>
  </el-dialog>
</div>
</template>

<script>
import {exportWord} from "@/components/exportFunction";

export default {
  name: "exportDialogComponent",
  data() {
    return{
      dialogVisible : this.$store.state.exportDialog,
      exportForm: {
        name : '',
        height : 1000,
        width : 500
      },
      exportRules: {
        name: [
          {required: true, message: '请输入导出文件名', trigger: 'blur'},
        ],
        height: [
          {required: true, message: '请输入图片高度', trigger: 'blur'},
        ],
        width: [
          {required: true, message: '请输入图片宽度', trigger: 'blur'},
        ],
      }
    }
  },
  methods:{
    startExport() {
      exportWord(this.exportForm.height,this.exportForm.width,this.exportForm.name)
    }
  }
}
</script>

<style scoped>

</style>
